Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow late arriving child records to be related to correct parent #234

Closed
wants to merge 1 commit into from

Conversation

itsniper
Copy link

When a parent record of a to-one or to-many relationship arrives before it's child, an empty child object is created. When the child record arrives, another new object is created with no way to relate it to it's parent. By adding the primary key value when creating missing child objets they can then be found and updated when the child record arrives.

@itsniper
Copy link
Author

Looks like Issue #223 was opened for this.

@blackgold9
Copy link
Contributor

Hoping to get a unit test for this one. I just pushed a commit that should make writing tests easier (tests will now compile)

@itsniper
Copy link
Author

OK, cool! Got stuck doing planning all last week, but hopefully will have a chance to take another look this week. Took a quick look late that night we talked, and it may just be the way the JSON I'm getting is formatted. I'll let you know though. Thanks!

@itsniper
Copy link
Author

OK, so this ended up being an issue with the JSON. It was a to-one relationship, but in the JSON it only contained a single number for the ID of the child. From Saul's post on CIMGF I noticed that it seemed to only work that way if the value was an array of IDs, and it was a to-many relationship. The server-side is being developed in-house, so I was able to get them to "correct" the JSON.

Old (incorrect) JSON were "host" is the to-one relationship:
{
"sev":4,
"id":1,
"host":10,
"status":2
}

New (working) JSON:
{
"sev":4,
"id":1,
"host":
{
"id":10
},
"status":2
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants